﻿namespace Amazon.Checkout
{
    using System.Collections.Generic;
    using Orchard.Environment.Extensions.Models;
    using Orchard.Security.Permissions;

    public class Permissions : IPermissionProvider
    {
        public static readonly Permission ManagePromotions = new Permission { Description = "Manage promotions", Name = "ManagePromotions" };

        public static readonly Permission ManageTaxes = new Permission { Description = "Manage taxes", Name = "ManageTaxes" };

        public static readonly Permission ManageShippings = new Permission { Description = "Manage shippings", Name = "ManageShippings" };

        public virtual Feature Feature { get; set; }

        public IEnumerable<Permission> GetPermissions()
        {
            return new[] { ManagePromotions, ManageTaxes, ManageShippings };
        }

        public IEnumerable<PermissionStereotype> GetDefaultStereotypes()
        {
            return new[] 
            {
                new PermissionStereotype 
                {
                    Name = "Administrator",
                    Permissions = new[] { ManagePromotions, ManageTaxes, ManageShippings }
                },
                new PermissionStereotype 
                {
                    Name = "Editor",
                    Permissions = new[] { ManagePromotions, ManageTaxes, ManageShippings }
                },
                new PermissionStereotype
                {
                    Name = "Moderator",
                    Permissions = new[] { ManagePromotions, ManageTaxes, ManageShippings }
                },
                new PermissionStereotype 
                {
                    Name = "Author",
                },
                new PermissionStereotype 
                {
                    Name = "Contributor",
                },
            };
        }
    }
}